package com.yupi.aicodehelper.config;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import redis.clients.jedis.JedisPool;

import javax.sql.DataSource;

public class DataConfig {

    // 创建 Redis 连接池
    public static JedisPool jedisPool() {
        return new JedisPool("localhost", 6380);
    }

    // 创建 MySQL 数据源
    public static DataSource dataSource() {
        HikariConfig config = new HikariConfig();
        config.setJdbcUrl("jdbc:mysql://localhost:33060/ai_code_helper?useSSL=false&characterEncoding=utf8");
        config.setUsername("root");
        config.setPassword("ztfasdf123");
        config.setMaximumPoolSize(10);
        return new HikariDataSource(config);
    }
}